Completed
Pull Request — master (#13)
by Justin
07:02
created

not copy instancesꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 9.4285
1
var assert = require('chai').assert,
2
    GedcomX = require('../');
3
4
describe('SourceCitation', function(){
5
  
6
  it('Create plain', function(){
7
    assert.instanceOf(new GedcomX.SourceCitation(), GedcomX.SourceCitation, 'An instance of SourceCitation is not returned when calling the constructor with new.');
8
    assert.instanceOf(GedcomX.SourceCitation(), GedcomX.SourceCitation, 'An instance of SourceCitation is not returned when calling the constructor without new.');
9
  });
10
  
11
  it('Create with JSON', function(){
12
    var citation = GedcomX.SourceCitation({
13
      lang: 'en',
14
      value: 'a full text citation'
15
    });
16
    assert.equal(citation.getLang(), 'en');
17
    assert.equal(citation.getValue(), 'a full text citation');
18
  });
19
  
20
  it('Build', function(){
21
    var citation = GedcomX.SourceCitation()
22
      .setLang('en')
23
      .setValue('a full text citation');
24
    assert.equal(citation.getLang(), 'en');
25
    assert.equal(citation.getValue(), 'a full text citation');
26
  });
27
  
28
  it('toJSON', function(){
29
    var data = {
30
      lang: 'en',
31
      value: 'a full text citation'
32
    }, citation = GedcomX.SourceCitation(data);
33
    assert.deepEqual(citation.toJSON(), data);
34
  });
35
  
36
  it('constructor does not copy instances', function(){
37
    var obj1 = GedcomX.SourceCitation();
38
    var obj2 = GedcomX.SourceCitation(obj1);
39
    assert.strictEqual(obj1, obj2);
40
  });
41
  
42
});